﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="YoProgramo.Infrastructure.Tools.PagedList"%>
<%@ Import Namespace="YoProgramo.Domain.BusinessLogic.Service"%>
<%@ Import Namespace="YoProgramo.Domain.Core.Entities"%>
<%@ Import Namespace="YoProgramo.Domain.Core.Interfaces"%>
<%@ Import Namespace="YoProgramo.BusinessLogic.Service"%>
<%@ Import Namespace="Microsoft.Practices.ServiceLocation"%>

    <%
      var s = (IPagedList<IMarkAsSpam<Comment>>)ViewData.Model;                             
    %>
       
    <table cellpadding=15 width="690px" class="TableAdmin">
      <tr class="TableAdminHead">
        <td>
          Id Spam
        </td>
        <td>
          Id Com.
        </td>    
        <td>
          Usuario
        </td>    
        <td>
          Estado
        </td>         
        <td>
          Fecha
        </td>
        <td>
          Por
        </td>        
        <td>
          Ip
        </td>                 
        <td>
          Acciones
        </td>        
      </tr>
    <%foreach (IMarkAsSpam<Comment> spam in s)
    {
    %>    
      <tr class="rowsimple">
        <td>
          <%=spam.Id %>
        </td>
        <td>
          <a href="/administration/EditComment/<%=spam.SpamFor.Id %>" class="linktooltip" title="<%=spam.SpamFor.HtmlBody %>"><%=spam.SpamFor.Id %></a>
        </td>
        <td>
          <%= spam.SpamFor.ByUser.UserName %>
        </td>         
        <td>
          <%= spam.Approved.ToString() %>
        </td>           
        <td>
          <%= spam.MarkedAt.ToShortDateString()  %>
        </td>
        <td>
          <%= spam.ByUser.UserName  %>
        </td>        
        <td>
          <%= spam.FromIPAddress %>
        </td>        
        <td>
        <%if(!spam.Approved){%>
          <% using (Html.BeginRouteForm("Admin", new { action = "AproveCommentSpam", id = spam.Id }, FormMethod.Post, new { id = "form-del-" + spam.Id.ToString() }))  
          { %>  
           <a href="javascript:" onclick="javascript: $('#form-del-<%= spam.Id %>').submit();">Aprobar</a>  
          <% } %>         
        <%}%>               
          <% using (Html.BeginRouteForm("Admin", new { action = "DeleteCommentSpam", id = spam.Id }, FormMethod.Post, new { id = "form-del-" + spam.Id.ToString() }))  
          { %>  
           <a href="javascript:" onclick="javascript: $('#form-del-<%= spam.Id %>').submit();">Borrar</a>  
          <% } %>
                                 
        </td>
      </tr>      
      <%
    }%>  
    </table>       
           
    <%= Html.Paging<IMarkAsSpam<Comment>>(s, ViewData["UrlPaging"] as string, "__PAGENUM__")%>

